$(function() {
	new Vue({
		el: '#rejectGoodListApp',
		data: {
			currentPage:100,
			formLabelWidth:"110px",
			dialogFormVisible:false,
			dialogRejectFormVisible:false,
			fullscreenLoading:false,
			searchdeliver:"",
			tableData:[ ],
			form:{
				address:"",
				toUser:"",
				fromUser:"",
				id:"",
				reason:"",
				
			}
		},
		created:function(){
			parent.vueData.$data.hreHtml="../applyRejectGoodList/index.html";
			parent.vueData.activeIndex  = "7";
			parent.vueData.getLeftNav("7")
			parent.vueData.$data.categoryIndex = 3
            this.selectRefundApply()
		},
		methods: {
			selectRefundApply(){
				this.fullscreenLoading = true;
				let shopId  = getShopId()
				let param = {
					shopId: shopId,
					admin_grade:"1",
				}
				axios({
					url: POSTURL.selectRefundApply,
					method: 'post',
					data: param
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						console.log(response.data.result);
						this.tableData = response.data.result
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				})  
			},
			//确认收货
			handleConfigGood(row){
				this.dialogFormVisible = true;
				this.form.toUser = row.uuid;
				this.form.id = row.id;
			},
			 //拒绝收货
			handleRejectGood(row){
				 this.dialogRejectFormVisible = true;
				 this.form.toUser = row.uuid;
				 this.form.id = row.id;
			},
			//同意
			configRefuse(){
				this.dialogFormVisible = false;
				this.fullscreenLoading = true;
				let uuid  = getUUId()
				let upFrom  = {}
				upFrom.toUser  = this.form.toUser
				upFrom.fromUser  = uuid
				upFrom.message  = this.form.address
				upFrom.operation  =  0
				upFrom.id  = this.form.id
				upFrom.admin_grade="1"
				axios({
					url: POSTURL.refundApplyOperation,
					method:'post',
					data: upFrom
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						this.$message({
							showClose: true,
							message: response.data.message,
							type: 'success'
						});
						this.form = {}
						 this.selectRefundApply()
						
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				})  
			},
			//拒绝
			configReject(){
				this.dialogRejectFormVisible = false;
				this.fullscreenLoading = true;
				let uuid  = getUUId()
				let upFrom  = {}
				upFrom.toUser  = this.form.toUser
				upFrom.fromUser  = uuid
				upFrom.message  = this.form.reason
				upFrom.operation  =  1
				upFrom.id  = this.form.id
				upFrom.admin_grade="1"
				axios({
					url: POSTURL.refundApplyOperation,
					method:'post',
					data: upFrom
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						this.$message({
							showClose: true,
							message: response.data.message,
							type: 'success'
						});
						this.form = {}
						 this.selectRefundApply()
						
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				})  
			},
			
		}
	})
})